import requests
import pprint#解析json数据
base_url='https://www.ku6.com/video/feed?pageNo=0&pageSize=40&subjectId=76'
headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'
    }
response=requests.get(base_url,headers=headers)
#html=response.text
data=response.json()
#pprint.pprint(data)
#解析数据
data_list=data['data']
#pprint.pprint(data_list)

for data1 in data_list:
    vedio_title=data1['title']+".mp4"
    vedio_url=data1['playUrl']
    #print(vedio_title,vedio_url)

   #请求视频数据
    vedio_data=requests.get(vedio_url,headers=headers).content
    #保存数据
    with open("王者\\"+vedio_title,mode='wb') as f:
        print("正在下载",vedio_title)
        f.write(vedio_data)
        print("下载完成...")
